package com.isoft.entity;

import com.fasterxml.jackson.annotation.JsonProperty;
import jakarta.xml.bind.annotation.*;
import lombok.Data;

@Data
@XmlRootElement(name = "MSG")
@XmlAccessorType(XmlAccessType.FIELD)
public class BaseApueEntity {
    @JsonProperty("meta")
    @XmlElement(name = "META")
    private Meta meta;

    @JsonProperty("apot")
    @XmlElement(name = "APOT")
    private Apot apot;

    @Data
    @XmlAccessorType(XmlAccessType.FIELD)
    public static class Meta {
        private Long msgId; // 添加msgId字段用于接收自增ID

        @XmlElement(name = "SNDR")
        private String sender;

        @XmlElement(name = "RCVR")
        private String receiver;

        @XmlElement(name = "SEQN")
        private Long sequenceNumber;

        @XmlElement(name = "DDTM")
        private String dateTime;

        @XmlElement(name = "TYPE")
        private String type;

        @XmlElement(name = "STYP")
        private String subType;

        public Long getMsgId() {
            return msgId;
        }

        public void setMsgId(Long msgId) {
            this.msgId = msgId;
        }
    }

    @Data
    @XmlAccessorType(XmlAccessType.FIELD)
    public static class Apot {
        @XmlElement(name = "CODE")
        private String airportCode;

        @XmlElement(name = "FRCD")
        private String iataCode;

        @XmlElement(name = "APAT")
        private String airportTerminal;

        @XmlElement(name = "CNNM")
        private String chineseName;

        @XmlElement(name = "ENNM")
        private String englishName;

        @XmlElement(name = "AISO")
        private String isOpen;

        @XmlElement(name = "APSN")
        private String shortName;

        public String getAirportCode() {
            return airportCode;
        }

        public void setAirportCode(String airportCode) {
            this.airportCode = airportCode;
        }
    }

    public Meta getMeta() {
        return meta;
    }

    public void setMeta(Meta meta) {
        this.meta = meta;
    }

    public Apot getApot() {
        return apot;
    }

    public void setApot(Apot apot) {
        this.apot = apot;
    }
}